﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin.Master" AutoEventWireup="true" CodeBehind="frm_Criterios.aspx.cs" Inherits="ED_Nivelacion.PresentacionWeb.frm_Criterios" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .auto-style2 {
            width: 175px;
            height: 38px;
        }

        .auto-style15 {
            width: 333px;
            height: 39px;
        }

        .auto-style16 {
            width: 333px;
            height: 38px;
        }

        .auto-style17 {
            width: 175px;
            height: 39px;
        }

        .auto-style19 {
            height: 36px;
        }

        .auto-style21 {
            width: 213px;
        }

        .auto-style22 {
            height: 36px;
            width: 213px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <form id="Form1" runat="server">

        <script>
            $(document).ready(function () {



                $(".error").remove();
                $(document).on("click", ".borrar", function () {

                    var id = $(this).data("id");
                    alert(id);
                    $('#ContentPlaceHolder1_TextBoxMiercoles').val(id);

                });


                $(document).on("click", ".editar", function () {

                    var criterio = $(this).data("criterio");
                    var valoracion = $(this).data("valor");
                    var item = $(this).data("item");
                    var item_nec = $(this).data("item_nec");
                    var ponderacion = $(this).data("ponderacion");
                    var id = $(this).data("id");
                    var id_v = $(this).data("idvaloracion");

                    //alert(id_v);


                    $('#ContentPlaceHolder1_txt_Criterio').val(criterio);
                    $('#ContentPlaceHolder1_txt_Porcentaje').val(valoracion);
                    $('#ContentPlaceHolder1_txt_Items').val(item);
                    $('#ContentPlaceHolder1_txt_Requeridos').val(item_nec);
                    $('#ContentPlaceHolder1_txt_Ponderación').val(ponderacion);
                    $('#ContentPlaceHolder1_txt_idC').val(id);
                    $('#ContentPlaceHolder1_txt_idV').val(id_v);
                    $('#ContentPlaceHolder1_Btn_Modificar_Criterio').show();
                    $('#ContentPlaceHolder1_Btn_Guardar_Criterio').hide();
                });

                $(document).on("click", ".guardar", function () {
                    $('#ContentPlaceHolder1_Btn_Modificar_Criterio').hide();
                    $('#ContentPlaceHolder1_Btn_Guardar_Criterio').show();
                });
            });

            function eliminar(idCriterio_Evaluacion) {

                //var id = $(this).data("id");
                alert(id);
                $('#ContentPlaceHolder1_idEliminar').val(id)
            }

            function limpiar() {
                $('#ContentPlaceHolder1_txt_Criterio').val("");
                $('#ContentPlaceHolder1_cbm_Periodo').val("");
                $('#ContentPlaceHolder1_txt_Porcentaje').val("");
                $('#ContentPlaceHolder1_txt_Items').val("");
                $('#ContentPlaceHolder1_txt_Requeridos').val("");
                $('#ContentPlaceHolder1_txt_Ponderación').val("");
            }

            //$(document).on("click", ".validar", function () {
            //    $(".error").remove();
            //    $('#ContentPlaceHolder1_Btn_Modificar_Criterio').hide();
            //    $('#ContentPlaceHolder1_Btn_Guardar_Criterio').hide();

            //    var items = $('#ContentPlaceHolder1_txt_Items').val();
            //    var requeridos = $('#ContentPlaceHolder1_txt_Requeridos').val();

            //    if (items == "")
            //    {
            //        $('#ContentPlaceHolder1_txt_Items').focus().after("<span class='error'>Campo obligatorio</span>");
            //        return false;
            //    }
            //    if (requeridos == "") {
            //        $('#ContentPlaceHolder1_txt_Requeridos').focus().after("<span class='error'>Campo obligatorio</span>");
            //        return false;
            //    }
            //    if (requeridos > items)
            //    {
            //        $('#ContentPlaceHolder1_txt_Requeridos').focus().after("<span class='error'>Requeridos no puede ser mayor a items</span>");
            //        return false;

            //    }

            //    $('#ContentPlaceHolder1_Btn_Guardar_Criterio').show();
            //});

        </script>

        <% ED_Nivelacion.Negocios.CriterioEvaluacion_C _objCriterio_C = new ED_Nivelacion.Negocios.CriterioEvaluacion_C(); 
        %>
        <div class="row">
            <div class="col-md-3 col-sm-12 col-xs-12">
            </div>

            <asp:ScriptManager ID="ScriptManager1" runat="server">
            </asp:ScriptManager>
            &nbsp;<asp:Timer ID="Timer1" runat="server">
            </asp:Timer>
            <!-- /. ROW  -->

            <!-- /. ROW  -->

        </div>
        <!-- /. PAGE INNER  -->

        <div class="col-lg-22">
            <div class="portlet portlet-default">
                <div class="portlet-heading">
                    <div class="portlet-title">
                        <h4>Criterios de Evaluación</h4>
                        <asp:TextBox ID="idEliminar" runat="server" CssClass="hidden"></asp:TextBox>

                        <asp:TextBox ID="TextBoxMiercoles" runat="server" CssClass="hidden"></asp:TextBox>
                    </div>
                    <div class="clearfix">
                        <div class="portlet-widgets">
                            <a class="btn btn-success btn-xs guardar" data-toggle="modal" data-target="#AgregarCriterio" onclick="limpiar()"><i class="fa fa-plus">Agregar </i></a>
                        </div>
                    </div>
                </div>
                <div class="portlet-body">
                    <div class="table-responsive">
                        <table id="example-table" class="table table-striped table-bordered table-hover table-green">
                            <thead>

                                <tr>
                                    <th>#</th>
                                    <th>CRITERIO</th>
                                    <th class="auto-style21">PORCENTAJE</th>
                                    <th>ACCIONES</th>
                                </tr>
                            </thead>
                            <% foreach (var item in _objCriterio_C.ObtenerCriterio())
                               {
                                                               
                            %>
                            <tr class="odd gradeX">
                                <td class="auto-style19"><%=item.idCriterio_Evaluacion %></td>
                                <td class="auto-style19"><%=item.Criterio %></td>
                                <td class="auto-style22"><%=item.Valoracion %></td>
                                <td class="auto-style19"><a class="btn btn-orange btn-large editar" data-toggle="modal" data-target="#AgregarCriterio" data-id="<%=item.idCriterio_Evaluacion %>" data-criterio="<%=item.Criterio %>" data-valor="<%=item.Valoracion %>">Modificar </a>&nbsp;</td>
                            </tr>
                            <%} %>
                        </table>
                    </div>
                    <!-- /.table-responsive -->
                </div>
                <!-- /.portlet-body -->
            </div>
            <!-- /.portlet -->

        </div>

        <div class="col-lg-22">
            <div class="modal modal-flex fade" id="AgregarCriterio" tabindex="-1" role="dialog" aria-labelledby="flexModalLabel" aria-hidden="true">
                <div class="modal-dialog">
                    <div class="modal-content">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                            <h4 class="modal-title" id="flexModalLabel">Agregar Criterio</h4>
                        </div>
                        <div id="Div1" class="modal-body" runat="server">
                            <div class="panel panel-default">

                                <div class="panel-body">
                                    <asp:TextBox ID="txt_idC" runat="server" CssClass="hidden"></asp:TextBox>
                                    <asp:TextBox ID="txt_idV" runat="server" CssClass="hidden"></asp:TextBox>
                                    <table class="table table-striped table-bordered table-hover">
                                        <thead>
                                        </thead>
                                        <tbody>
                                            <tr>
                                                <td class="auto-style17">Criterio de Evaluación:</td>
                                                <td class="auto-style15">
                                                    <asp:TextBox ID="txt_Criterio" runat="server"></asp:TextBox>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td class="auto-style2">Porcentaje:</td>
                                                <td class="auto-style16">
                                                    <asp:TextBox ID="txt_Porcentaje" runat="server"></asp:TextBox>
                                                </td>
                                            </tr>


                                        </tbody>
                                    </table>
                                </div>
                            </div>
                        </div>
                        <div class="modal-footer">

                            <asp:Button ID="Btn_Guardar_Criterio" runat="server" CssClass="btn btn-default btn-sm" Text="GUARDAR" OnClick="Btn_Guardar_Click" />

                            <asp:Button ID="Btn_Modificar_Criterio" runat="server" CssClass="btn btn-default btn-sm" Text="MODIFICAR" OnClick="Btn_Modificar_Criterio_Click" />

                        </div>
                    </div>
                    <!-- /.modal-content -->
                </div>
                <!-- /.modal-dialog -->
            </div>
            <!-- /.modal -->
        </div>


        <script>
            $('[data-id]').click(function () {
                var Id = $(this).data('id');
                $("#ContentPlaceHolder1_idEliminar").val(Id);
                //alert(Id);
            });
            $('[data-toggle="confirmation"]').confirmation({
                placement: 'top', // How to position the confirmation - top | bottom | left | right
                trigger: 'click', // How confirmation is triggered - click | hover | focus | manual
                title: 'Esta seguro?', // Default title value if `data-title` attribute isn't present  
                template: '<div class="popover" >' +
                    '<div class="arrow"></div>' +
                    '<h3 class="popover-title"></h3>' +
                    '<div class="popover-content text-center">' +
                    '<div id="botones" class="btn-group">' +
                    '<asp:LinkButton ID="BtnEliminar" runat="server" CssClass="btn btn-success btn-xs" OnClick="Delete_Click"><i class="fa fa-check-circle icon-white"></i> Si</asp:LinkButton>' +
                    '<a class="btn btn-xs" data-dismiss="confirmation"></a>' +
                    '</div>' +
                    '</div>'
                , btnOkClass: 'btn-primary'
                , btnOkIcon: 'fa fa-check-circle'
                , btnCancelClass: 'btn-danger'
                , btnOkLabel: 'Si'
                , btnCancelIcon: 'fa fa-times-circle'
                , btnCancelLabel: 'No',
                singleton: true, // Set true to allow only one confirmation to show at a time.
                popout: false, // Set true to hide the confirmation when user clicks outside of it.
                onConfirm: function () {

                }, // Set event when click at confirm button
                onCancel: function () { }
            }); // Set event when click at cancel button
        </script>


    </form>
</asp:Content>
